<?php
/**
 * Framework.php is the core of WP Framework which defines the main class
 * and core functions.
 *
 * @package WP_Framework
 */
 
/* Prevent users from directly loading this file */
defined( 'WP_FRAMEWORK' ) or die ( 'Error: This file can not be loaded directly.' );

/**
 * WPFramework - Main Class sets up Framework enviroment
 * 
 * @since - 0.1
 */
class WPFramework
{
	/**
	 * init() - Class constructor
	 *
	 * @since - 0.1
	 */
	function init()
	{
		/* Remove Generator Link - Credits: (http://www.plaintxt.org) */
		function remove_generator_link() { return ''; }
		add_filter( 'the_generator', 'remove_generator_link', 1 );
		
		/* Register Widgets */
		if ( function_exists( 'register_sidebars' ) ) {
			register_sidebars( 1, array(
				'name' => 'Secondary',
				'before_widget' => '<div id="%1$s" class="widgets %2$s">',
				'after_widget' => '</div>',
				'before_title' => '<li class="widgets-title"><h3>',
				'after_title' => '</h3></li>',
			)); /* register_sidebar() */
		} /* if ( function_exists( 'register_sidebars' ) ) */
	} /* function init() */
} /* class WPFramework */

/**
 * wpframework_credits() - Echos credits link
 *
 * @since - 0.1
 */
function wpframework_credits( $sep = '&mdash;' ) {
	echo "Built on <a href=\"http://wpframework.com\">WP Framework</a> $sep Powered by <a href=\"http://wordpress.org\">WordPress</a>";
}

/**
 * generate_title_tag() - Generates Title tag with extra SEO love.
 *
 * @since - 0.1
 * @return SEO formatted title tag. See header.php:17
 */
function generate_title_tag() {
	if ( is_single() ) : wp_title( '&raquo;', true, 'right' ); bloginfo( 'name' );
	echo ( ' - ' );
	echo bloginfo( 'description' );
	
	elseif ( is_page() || is_paged() ) : wp_title( '&raquo;', true, 'right' ); 
	bloginfo( 'name' ); echo ( ' - ' );
	echo bloginfo( 'description' );
	
	elseif ( is_author() ) : wp_title( 'Archives for ', true, 'left' );
	echo ( ' &raquo; ' ); bloginfo( 'name' );
	echo ( ' - ' );
	echo bloginfo( 'description' );
	  
	elseif ( is_archive() ) : wp_title( 'Archives for ', true, 'left' );
	echo ( ' &raquo; ' ); bloginfo( 'name' );
	echo ( ' - ' );
	echo bloginfo( 'description' );
	
	elseif ( is_search() ) : wp_title( 'Search Results ', true, 'left' );
	echo ( ' &raquo; ' ); bloginfo( 'name' );
	echo ( ' - ' );
	echo bloginfo( 'description' );
	
	elseif ( is_404() ) : wp_title( '404 Error Page Not Found ', true, 'left ');
	echo ( ' &raquo; ' ); bloginfo( 'name' );
	echo ( ' - ' );
	echo bloginfo( 'description' );
	
	else : wp_title( '&raquo', true, 'left' ); bloginfo( 'name' );
	echo ( ' - ' );
	echo bloginfo( 'description' );		
	endif;
}

?>